{% extends 'base/base.html' %}

{% block body %}

{% block other %}{% endblock %}

<div class="ibox float-e-margins">
    <div class="ibox-title">
        <h5>{{ table_title }} </h5>
        <div class="ibox-tools">
           {% block table_btn %}{% endblock %}
            每页
            <select name="DataTables_Table_0_length" aria-controls="DataTables_Table_0" class="input-sm" id="pages">
                <option value="10">10</option>
                <option value="25">25</option>
                <option value="50">50</option>
                <option value="100">100</option>
            </select>
            条
            <a class="collapse-link">
                <i class="fa fa-chevron-up"></i>
            </a>
        </div>
    </div>
    <div class="ibox-content">
        <table class="{{ table_class }}">
            <thead>
                {% block table_thead %}{% endblock %}
            </thead>
            <tbody id="{{ table_id }}">
                {% block table_bady %}{% endblock %}
            </tbody>
        </table>
    </div>
    <ul class="pagination pull-right">
        <li class="footable-page-arrow"><a data-page="first" href="{{ page_url }}?page=1&{{ search }}&entry={{ entry }}">«</a></li>
        {% if objects.has_previous %}
        <li class="footable-page-arrow"><a data-page="prev" href="{{ page_url }}?page={{ objects.previous_page_number }}&{{ search }}&entry={{ entry }}">‹</a></li>
        {% else %}
        <li class="footable-page-arrow disabled"><a data-page="prev" href="#">‹</a></li>
        {% endif %}
        {% for num in objects.paginator.page_range %}
        {% if num == objects.number %}
        <li class="footable-page active"><a data-page="1" href="{{ page_url }}?page={{ num }}&{{ search }}&entry={{ entry }}">{{ num }}</a></li>
        {% else %}
        <li class="footable-page"><a data-page="1" href="{{ page_url }}?page={{ num }}&{{ search }}&entry={{ entry }}">{{ num }}</a></li>
        {% endif %}
        {% endfor %}
        {% if objects.has_next %}
        <li class="footable-page-arrow"><a data-page="next" href="{{ page_url }}?page={{ objects.next_page_number }}&{{ search }}&entry={{ entry }}">›</a></li>
        {% else %}
        <li class="footable-page-arrow disabled"><a data-page="next" href="#">›</a></li>
        {% endif %}
        <li class="footable-page-arrow"><a data-page="last" href="{{ page_url }}?page={{ objects.paginator.num_pages }}&{{ search }}&entry={{ entry }}">»</a></li>
    </ul>
</div>

{% endblock %}